import axios from 'axios'

const api = axios.create({
    baseURL: 'http://110.40.137.140:2048/api'
})

export const login = (username) => {
    return api.post('/login', { username })
}

export const getSaves = (username) => {
    return api.get(`/saves/${username}`)
}

export const saveGame = (username, gameState, currentScore, saveId) => {
    return api.post('/save', { username, gameState, currentScore, saveId })
}

export const getLeaderboard = () => {
    return api.get('/leaderboard')
}

export const hideSave = (saveId) => {
    return api.put(`/saves/${saveId}/hide`)
}

export default api 